package com.example.util;

import com.sun.el.parser.ParseException;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
@Component
public class DateUtils {
    //将字符串弄成时间
    public static Date  createDate(String time){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date dateTime = null;
        try {
            dateTime = simpleDateFormat.parse(time);
            return dateTime;
        } catch (java.text.ParseException e) {
            e.printStackTrace();
        }
        return dateTime;
    }
}
